﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using VideoBlog.Data.Entities;

namespace VideoBlog.Web.Helpers
{
    public static class ApplicationHelper
    {
        public static Application Current()
        {
            HttpRequest req = HttpContext.Current.Request;
            VideoBlogEntities2 db = new VideoBlogEntities2();
            Application app = db.Application.Where(o=>o.ApplicationHost == "localhost:1968").First();
            return app;
        }
        public static List<Category> Categories()
        {
            VideoBlogEntities2 db = new VideoBlogEntities2();
            List<Category> categories = db.Category.Include("Playlist.Video").ToList();
            return categories;
        }

        public static List<Playlist> Playlists()
        {
            VideoBlogEntities2 db = new VideoBlogEntities2();
            List<Playlist> playlists = db.Playlist.Include("Video").ToList();
            return playlists;
        }
        public static List<Playlist> FeaturedPlaylists
        {
            get { 
                 VideoBlogEntities2 db = new VideoBlogEntities2();
                List<Playlist> playlists = db.Playlist.Include("Video").Include("Category").Where(o=>o.FrontPageFeatured).OrderBy(o=>o.FrontPageDisplayOrder).ToList();
                return playlists;
            }
        
        }

    }
}
